package com.wzcl.app.model.vo;


import com.wzcl.app.dao.model.VideoResources;
import com.wzcl.app.model.common.WZCL;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Map;

@Data
public class VideoResourceVo extends BaseVo{
    @ApiModelProperty(value = "资源ID")
    private Integer resourceId;

    @ApiModelProperty(value = "资源类型")
    private Integer resourceType;
    private String resourceTypeStr;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "资源对应的key值")
    private String fileKey;

    @ApiModelProperty(value = "封面图")
    private String previewImage;

    @ApiModelProperty(value = "当前资源收费类型")
    private Integer chargeType;
    private String chargeTypeStr;

    @ApiModelProperty(value = "排序字段")
    private Integer orderNo;

    private VideoResourceVo() {
    }

    public static VideoResourceVo create(VideoResources videoResources){
        VideoResourceVo videoResourceVo = new VideoResourceVo();
        BeanUtils.copyProperties(videoResources,videoResourceVo);
        videoResourceVo.translationValueStr();
        return videoResourceVo;
    }

    @Override
    public void translationValueStr() {
        Map<String, Map<Integer, String>> map = getTranslationMap();
        this.resourceTypeStr = map.get(WZCL.GROUP_NAME.VIDEO_RESOURCE_TYPE).get(this.resourceType);
        this.chargeTypeStr = map.get(WZCL.GROUP_NAME.VIDEO_CHARGE_TYPE).get(this.chargeType);
    }

    @Override
    public void processResources() {

    }
}
